{extend name="public/menu2" /}
{block name='title'}-{$cur.name}{/block}

{block name='content'}
<div class="right">
    <div class="right_content">
        <div class="consult_content">
            <div class="map">
                {$content.content|raw|default=''}
            </div>

            <div class="apply_content">

                <div class="apply_title">
                    <h5>{:setting('company')}</h5>
                    <p>{:setting('company_en')}</p>
                </div>

                <div class="apply_form">

                    <div class="form_left">
                        <ul>
                            {php}$list = json_decode(setting('list'),true);{/php}
                            {foreach $list as $l}
                            <li>
                                <img src="{$l.thumb ?: ''}" />
                                <div class="form_brief">
                                    <h5>{$l.name ?: ''}</h5>
                                    <p>{$l.value ?: ''}</p>
                                </div>
                            </li>
                            {/foreach}
                        </ul>
                    </div>

                    <form class="form_right">
                        <div class="form_list">
                            <div class="form_content">
                                <span>姓名</span>
                                <input type="text" name="name" placeholder="" />
                            </div>
                            <div class="form_content">
                                <span>电话</span>
                                <input type="text" name="tel" placeholder="" />
                            </div>
                            <div class="form_content">
                                <span>合作意向</span>
                                <select name="type">

                                    <option>分校加盟</option>
                                    <option>营地合作</option>

                                </select>
                            </div>
                            <div class="form_content">
                                <span>您的单位</span>
                                <input type="text" name="company" placeholder="" />
                            </div>
                            <div class="form_content">
                                <textarea placeholder="留言" name="content"></textarea>
                            </div>
                        </div>
                        <button class="btn" type="button">提交</button>
                    </form>
                </div>

            </div>

        </div>

    </div>

</div>

</div>
{/block}

{block name='script'}
<link rel="stylesheet" type="text/css" href="__STATIC__/index/css/reset.css" />
<link rel="stylesheet" type="text/css" href="__STATIC__/index/css/teacher.css" />

<script>
    $(function () {
        $('.btn').on('click',function () {
            var name = $('[name="name"]').val();
            var tel = $('[name="tel"]').val();
            var type = $('[name="type"]').val();
            var company = $('[name="company"]').val();
            var content = $('[name="content"]').val();
            var arr = [name,tel,type,company,content];
            var key = ['name','tel','type','company','content'];
            for ( var i = 0; i <arr.length; i++){
                if (arr[i]==''){
                    $('[name="'+key[i]+'"]').focus();
                    return false;
                }
            }
            $.ajax({
                url:'{:url("/apply4")}',
                type:'post',
                data:{name:name,tel:tel,type:type,company:company,content:content},
                success:function (res) {
                    if(res.code==1){
                        alert('提交成功！');
                        location.reload();
                    }else if(res.code=='busy'){
                        alert('您操作太频繁啦，稍后再来吧！');
                    }else {
                        $('[name="'+res.code+'"]').focus();
                    }
                }
            })
        })
    })
</script>

{/block}